<template>
    <div class="home-page">
        <section class="pl-5 text-center container">
            <div class="row py-lg-5">
                <div class="col-lg-6 col-md-8 mx-auto">
                    <img src="../assets/patterns.e8579768.png" alt="" class="w-50">
                    <h2 class="font-weight-light">随心写作，自由发挥</h2>
                    <router-link to="/create" href="#" class="btn btn-primary my-2">开始写文章</router-link>
                </div>
            </div>
        </section>
        <h4 class="font-weight-bold text-center">发现精彩</h4>
        <colmun-list :list="list"></colmun-list>
    </div>
</template>

<script lang="ts">
import { computed, defineComponent, onMounted } from 'vue'
import { testData } from '../testData'
import ColmunList from '@/components/ColmunList.vue'
import { useStore } from 'vuex'
import { GolbalDataProps } from '@/store'

export default defineComponent({
    components:{
        ColmunList
    },
    setup () {
        const store = useStore<GolbalDataProps>()
        const list = computed(() => store.state.colmuns)
        const biggerColmunLen = computed(() => store.getters.biggerColmunLen)
        onMounted(() => {
            store.dispatch('fetchColmuns')
        })
         return {
            list: list,
            biggerColmunLen
         }
    }
})
</script>

<style>

</style>